package h_SET;

import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package h_SET
 * @date 2024/4/10 下午6:41
 */
public class Test01 {
    public static void main(String[] args) {
        LinkedHashSet<String> set = new LinkedHashSet<>();
        set.add("a");
        set.add("b");
        set.add("c");
        set.add("d");

        System.out.println(set);
//迭代器
        Iterator<String> it = set.iterator();
        while (it.hasNext()) {
            String str = it.next();
            System.out.println(str);
        }
        //fori
        for (String s : set) {
            System.out.println(s);
        }
    }
}
